package com.yukh.framework.mybatis.generator.page.demo2.dao;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.yukh.framework.mybatis.generator.page.demo2.model.UserInfo;
import com.yukh.framework.mybatis.generator.page.demo2.model.UserInfoExample;

public class UserInfoDAOImpl extends SqlMapClientDaoSupport implements UserInfoDAO {

    public UserInfoDAOImpl() {
        super();
    }

    public int countByExample(UserInfoExample example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("t_user_info.countByExample", example);
        return count;
    }

    public int deleteByExample(UserInfoExample example) {
        int rows = getSqlMapClientTemplate().delete("t_user_info.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(Integer userid) {
        UserInfo _key = new UserInfo();
        _key.setUserid(userid);
        int rows = getSqlMapClientTemplate().delete("t_user_info.deleteByPrimaryKey", _key);
        return rows;
    }

    public Integer insert(UserInfo record) {
        Object newKey = getSqlMapClientTemplate().insert("t_user_info.insert", record);
        return (Integer) newKey;
    }

    public Integer insertSelective(UserInfo record) {
        Object newKey = getSqlMapClientTemplate().insert("t_user_info.insertSelective", record);
        return (Integer) newKey;
    }

    @SuppressWarnings("unchecked")
    public List<UserInfo> selectByExample(UserInfoExample example) {
        List<UserInfo> list = getSqlMapClientTemplate().queryForList("t_user_info.selectByExample", example);
        return list;
    }

    public UserInfo selectByPrimaryKey(Integer userid) {
        UserInfo _key = new UserInfo();
        _key.setUserid(userid);
        UserInfo record = (UserInfo) getSqlMapClientTemplate().queryForObject("t_user_info.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(UserInfo record, UserInfoExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("t_user_info.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(UserInfo record, UserInfoExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("t_user_info.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(UserInfo record) {
        int rows = getSqlMapClientTemplate().update("t_user_info.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(UserInfo record) {
        int rows = getSqlMapClientTemplate().update("t_user_info.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends UserInfoExample {
        private Object record;

        public UpdateByExampleParms(Object record, UserInfoExample example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}